// 加载测试用例
import path from 'path';

import { FilterOption, TaskTags } from '../project-builder/models/model-options';
import { requireAll } from '../project-builder/template/template-init';

import { testCaseCollection } from './task-case-builder';
import { TestCase } from './test-case';

// 加载测试用例文件
const testCasesPath = path.join(__dirname, '../', '../', 'test-cases');
requireAll(testCasesPath);

const findTestCases: (tags?: Partial<TaskTags> | FilterOption<TaskTags>) => TestCase[] =
  (tags) => {
    return testCaseCollection.findTestCases(tags);
  };

export const testCaseFactory = {
  findTestCases: findTestCases
};
